package com.abel.bigwater.dataserver.model.hgd

import io.netty.buffer.Unpooled
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test

class HgdaoTcpHeartTest {
    @Test
    fun testTrue() {
        val buf = Unpooled.buffer().writeBytes("@222:10002\r\n".toByteArray())
        val ht = HgdaoTcpHeart()
        assertTrue(ht.parseBuffer(buf))
    }

    @Test
    fun testFalse() {
        val buf = Unpooled.buffer().writeBytes("@221:11002\r\n".toByteArray())
        val ht = HgdaoTcpHeart()
        assertFalse("false because of not header", ht.parseBuffer(buf))
    }
}